package com.company.word.utils;

import com.company.word.pojo.User;

import java.sql.*;

public class Test {
    public static void main(String[] args) throws SQLException {
        Connection conn = JDBCUtils.getConnection();
        String sql = "select * from user where username=? and password=?";
        PreparedStatement stmt = conn.prepareStatement(sql);
        stmt.setString(1, "zhangsan");
        stmt.setString(2, "123456");
        // 3.
        ResultSet rs = stmt.executeQuery();
        User user = null;
        if(rs.next())
        {
            int id = rs.getInt(1);
            System.out.println(rs.getInt(1));
            System.out.println(rs.getString(2));
            System.out.println(rs.getString(3));
        }
    }
}
